package com.hutianao.gqgl.password.control;

import com.hutianao.gqgl.password.service.PasswordModifyService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

public class PasswordModifyController {
    //      修改密码
    @RequestMapping("/updatePassWord")
    @ResponseBody
    public Object updatePassWord(String password, String newpassword, String username, HttpSession session){
        Map<String,Object> map=new HashMap<>();

        int i= (int) PasswordModifyService.modifyPassword( password, newpassword, username, session);
        if(i==1){
            map.put("code",1);
            map.put("msg","修改成功！");

        }else {
            map.put("code",0);
            map.put("msg","修改失败");
        }
        return map;
    }

}
